package Bruce.GuavaDemo;

import com.google.common.base.Optional;
/**
 * Optional 抛出异常
 * @author Bruce
 *
 */
public class Hello {
	public static void main(String[] args) {
	     Integer invalidInput = null;
	      Optional<Integer> a =  Optional.of(invalidInput);
	      Optional<Integer> b =  Optional.of(new Integer(10));
	      System.out.println(sum(a,b));

	}

	static Integer sum(Optional<Integer> a, Optional<Integer> b) {
		return a.get() + b.get();
	}
}
